Description | Identifies arguments from a behavior function call as nav , dep , URL , NS4.0ref , IE4.0ref , objName , or other so that URLs in behaviors can be updated if the user saves the document to another location, and so that the referenced files can be displayed in the site map and considered dependent files for the purposes of uploading to and downloading from a server. |
||||||||||||||
Arguments | theFunctionCall |
||||||||||||||
This argument is the string that was returned earlier by the applyBehavior() function. |
|||||||||||||||
Returns | A string containing a comma-separated list of the types of arguments in the function call. The length of the list must equal the number of arguments in the function call. Argument types will always be one of the following: | ||||||||||||||
|
|||||||||||||||
Example | This simple example of identifyBehaviorArguments() would work for the Open Browser Window behavior action, which returns a function that always has three arguments (the URL to open, the name of the new window, and the list of window properties): |
||||||||||||||
function identifyBehaviorArguments(fnCallStr) { return "URL,other,other"; } |
|||||||||||||||
A more complex version of identifyBehaviorArguments() is necessary for behavior functions that have a variable number of arguments (such as Show/Hide Layer). This version of identifyBehaviorArguments() relies on the fact that there is a minimum number of arguments, and additional arguments always come in multiples of the minimum number. In other words, a function with a minimum number of arguments of 4 may have 4, 8, or 12 arguments, but it will never have 10 arguments. |
|||||||||||||||
![]() |
function identifyBehaviorArguments(fnCallStr) { var listOfArgTypes; var itemArray = dreamweaver.getTokens(fnCallStr, '(),'); //The array of items returned by getTokens() includes the function name, //so the number of *arguments* in the array is the length of the array //minus one. Divide by 4 to get the number of groups of arguments. var numArgGroups = ((itemArray.length - 1)/4); //For each group of arguments for (i=0; i < numArgGroups; i++){ //Add a comma and "NS4.0ref,IE4.0ref,other,dep" (because this //hypothetical behavior function has a minimum of four arguments: //the Netscape object reference, the IE object reference, a dependent //URL, and perhaps a property value such as "show" or "hide") to the //existing list of argument types, or if no list yet exists, add only //"NS4.0ref,IE4.0ref,other,dep" var listOfArgTypes += ((listOfArgTypes)?",":"") + "NS4.0ref,IE4.0ref,other,dep"; } } |
|
![]() |